package com.x.Part5_接口.Car;

/**
 * ClassName: VehicleTest
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.03.06 22:37
 */
public class VehicleTest {
    public static void main(String[] args) {

        Developer developer  = new Developer();

        Vehicle[] vehicles = new Vehicle[3];

        vehicles[0] =new Bicycle("千里达","white");
        vehicles[1] =new EleVehicle("雅迪","black");
        vehicles[2] =new OilCar("宝马","black","鲁R88888");

        for(int i = 0; i<vehicles.length; i++){
            developer.takingVehicle(vehicles[i]);

            if(vehicles[i] instanceof IPower){
                //判断是否有IPower接口，有则调用power方法
                ((IPower) vehicles[i]).power();
            }
            System.out.println("...........");
        }

    }
}
